package luo.Controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import luo.Service.RadarLogService;
import luo.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author:let_free
 * @Date:2024/9/18/14:49
 **/
@RestController
@Slf4j
@RequestMapping("/radarLog")
@Api(tags = "雷达日志")
public class RadarLogController {
    @Autowired
    private RadarLogService radarLogService;

    /**
     * @return luo.utils.AjaxResult
     * @description 获取最新的到达的雷达基文件的时间戳（加八小时之后的结果）以及未来20帧的文件名
     * @author let_free
     * @date 2024/10/1 14:16
     */
    @GetMapping("/getPredictionName")
    @ApiOperation(value = "获取雷达预测文件名")
    public AjaxResult getLatestLog() throws ParseException {
        String filename = radarLogService.getLatestName();
        List<String> nameList = radarLogService.getFuture20Name("", filename, "png", 20);
        Map<String, Object> map = new HashMap<>();
        map.put("nameList", nameList);
        map.put("currentName", filename);
        return AjaxResult.success(map);
    }
}
